var CreateInfo = function(){
	
	var ps = new ProjectSource();
	
	var createInfoStore = new Ext.data.JsonStore(
			{
				url : '../project/searchProjects.form?status=10&timesnap=' + new Date().getTime(),
				root : 'result',
				fields : [ 'PROJECT_ID', 'PROJECT_NAME', 'AREA_ID',
						'PROJECT_TYPE', 'EST_AMT', 'PROJECT_CREATE_DT',
						'EST_DT', 'JOIN_LEADER', 'CUSTOMER_NAME', 'STAFF_NUM',
						'CONTACT_PERSON', 'OFF_TEL', 'MOBILE', 'EMAIL',
						'PROJECT_TARGET', 'CUST_REQ', 'SERVICE_REQ',
						'IMP_FUNC', 'OWNER_PROVIDE', 'REMARK', 'COMPETITOR',
						'PROJECT_OWNER', 'INVOLVE_DT', 'ADVANTAGE',
						'DISADVANTAGE', 'CREATE_USER', 'CREATE_DT', 'MOD_USER',
						'MOD_DT' ]
			});
	var createGrid = new Ext.grid.GridPanel({
		width : 930,
		height : 160,
		store : createInfoStore,
		scope : this,
		listeners : {
			scope : this,
			rowmousedown : function(grid,index,e){
				var data = grid.store.getAt(index).data;
				ps.setCompValueAndDisabled(data);
				ps.projectIsVs.setValue(true);
				//ps.projectInfo.disable();ps.projectNeed.disable();
		       // ps.projectIsVs.setValue(true);ps.projectVsInfo.disable();
		        
			}
		},
		columns : [{header:'项目编号',width: 150,dataIndex:'PROJECT_ID'},
		           {header:'项目名称',width: 100, sortable: true,dataIndex:'PROJECT_NAME'},
		           {header:'所属区域',dataIndex:'AREA_ID',renderer:function(value,row){return ps.getGridAreaMap()[value];}},
		           {header:'项目类型',renderer:ps.renderprojectType,dataIndex:'PROJECT_TYPE'},
		           {header:'业务提供',dataIndex:'OWNER_PROVIDE'},
		           {header:'开始时间',dataIndex:'PROJECT_CREATE_DT'},
		           {header:'计划结束时间',dataIndex:'EST_DT'},
		           {header:'估算金额',renderer: 'usMoney',dataIndex:'EST_AMT'}],
       bbar:new Ext.PagingToolbar({
		 pageSize: 5,
         store: createInfoStore,
         displayInfo: true,
         displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条',
         emptyMsg: "没有记录..."
       })
	});
	
	var agree = new Ext.form.Radio( {
		boxLabel : '同意',
		name : 'status',
		checked:true,
		inputValue : 11
	});

	var unAgree = new Ext.form.Radio( {
		boxLabel : '不同意',
		name : 'status',
		inputValue : 12
	});
	
	var isAgree = new Ext.form.RadioGroup({
		fieldLabel : '是否同意立项',
		columns : 2,
		items : [agree,unAgree]
	});
	
	var remark = new Ext.form.TextArea({
		fieldLabel : '备注',
		width : 300
	});
	
	this.createPanel = new Ext.form.FormPanel({
		frame : true,
		width : 950,
		labelWidth : 85,
		buttons : [{text:'确定',iconCls: 'icon-accept',scope:this,handler:function(){doCreate(this.createPanel);}}],
		items : [createGrid,ps.projectInfo,ps.projectNeed,
		         ps.projectIsVs,ps.projectVsInfo,
		         {layout:'column',defaults:{layout:'form'},
		          items:[{columnWidth:0.3,items:[isAgree]},
		                 {columnWidth:0.7,items:[remark]}
		                ]}],
	    listeners: {
	    	render: {fn:function(){ 
					ps.getGridArea.load();
					createInfoStore.load();
					
		}}
	    }
	});
	//确定立项信息路径
	var addCon = new Ext.data.Connection({
		url:'../project/doCreateProject.form?timesnap=' + new Date().getTime(),
		method:'post'
	});
	var doCreate = function(dp){
		var projectId = ps.getProjectId();
		if(projectId!=''){
		    var r = isAgree.getValue();  
		    var value = r.inputValue;  
			Utils.request(addCon,{
				params:{
					project_id:projectId,
					project_status:value,
					remark:remark.getValue()
				},
				success:function(data){
					if(data.result=='true'){
						Utils.info("操作成功","系统提示");	
						createInfoStore.reload();
						dp.getForm().reset();
					}else{
						Utils.info("操作失败","系统提示");	
					}
				}
			});
		}else{
			Utils.info("请选择确定要立项的项目","系统提示");	
		}
	};
};